package com.ruoyi.quartz.task;

import cn.hutool.core.util.StrUtil;
import com.ruoyi.market.http.service.MarketApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalTime;

/**
 * 机构创得 免费量推送
 * 
 * @author ruoyi
 */
@Component("specialCDPushTask")
public class SpecialCDPushTask
{
    @Autowired
    MarketApiService marketApiService;

    public void taskFun(String startTime, String endTime)
    {
        System.out.println();
        System.out.println();
        System.out.println();
        System.out.println(startTime);
        System.out.println(endTime);
        System.out.println();
        System.out.println();

        String nowTime = LocalTime.now().toString();
        System.out.println(nowTime);

        if (StrUtil.compare(nowTime, startTime, true) > 0 &&
                StrUtil.compare(endTime, nowTime, true) > 0){
            int num = 5;
            for (int index = 0; index < num; index++){
                boolean b = marketApiService.runSpecialPushTask();
                if (b){
                    break;
                }
            }
        }
    }

}
